package com.zmx.common.common.entitys;

import com.fasterxml.jackson.annotation.JsonFormat;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Where;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;

/**
 * @Description: 数据传输抽象基类
 * @ClassName: BaseEntity
 * @Author zhaomxr
 * @Date 2021-09-24 10:56
 */
@MappedSuperclass
@Where(clause = "dr=0")
public abstract class BaseEntity implements Serializable, IEntity {

    @Id
    @GeneratedValue(strategy = GenerationType.AUTO, generator = "myIdentityGenerator")
    @GenericGenerator(name = "myIdentityGenerator", strategy = "com.zmx.common.common.config.MyIdentityGenerator")
    protected Long id;

    @Column(name = "creator")
    protected String creator;

    @Column(name = "create_time")
    protected Date createTime;

    @Column(name = "modifier")
    protected String modifier;

    @Column(name = "modifyTime")
    protected Date modifyTime;

    @Column(name = "dr")
    protected Integer dr;

    @Column(name = "ts")
    private Date ts;

    @Override
    public Long getId() {
        return id;
    }

    @Override
    public void setId(Long id) {
        this.id = id;
    }

    @Override
    public String getCreator() {
        return creator;
    }

    @Override
    public void setCreator(String creator) {
        this.creator = creator;
    }

    @Override
    public Date getCreateTime() {
        return createTime;
    }

    @Override
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    @Override
    public String getModifier() {
        return modifier;
    }

    @Override
    public void setModifier(String modifier) {
        this.modifier = modifier;
    }

    @Override
    public Date getModifyTime() {
        return modifyTime;
    }

    @Override
    public void setModifyTime(Date modifyTime) {
        this.modifyTime = modifyTime;
    }

    @Override
    public Integer getDr() {
        return dr;
    }

    @Override
    public void setDr(Integer dr) {
        this.dr = dr;
    }

    @Override
    public Date getTs() {
        return ts;
    }

    @Override
    public void setTs(Date ts) {
        this.ts = ts;
    }
}
